
define :stopinstr do
  name = params[:name]
  zkep = "#{node[:zookeeper][:ip]}:#{node[:zookeeper][:port]}"
  ruby_block "instrument end of #{name}" do
    block do            
      require 'zk'
      require 'json'
      begin
        wsInfo = []
        i_url = node[:client][:status]
        z = ZK.new(zkep)
        wsInfo = JSON.parse(z.get(i_url).first)
        wsInfo.last[:stop] = Time.now.to_i
        z.create(i_url, wsInfo.to_json, {:or => :set})
      ensure
        z.close
      end
    end
  end
end